<template>
	<!-- 员工信息 -->
	<view class="" v-show="show">
		<view class="toptext">
			<text class="text">{{title}}</text>
			<image @click="chang()" class="img1" src="../../../static/paimg/修改.png"></image>
		</view>
		<view class="boximg">
			<text class="text">头像</text>
			<image :src="list.headimg"></image>
		</view>
		<view class="boxtext">
			<text class="text">账号</text>
			<input class="input" disabled="false" type="text" v-model="list.account">
		</view>
		<view class="boxtext">
			<text class="text">员工名称</text>
			<input class="input" disabled="false" type="text" v-model="list.empname">
		</view>
		<view class="boxtext">
			<text class="text">员工编号</text>
			<input class="input" disabled="false" type="text" v-model="list.empid">
		</view>
		<view class="boxtext">
			<text class="text">所属部门</text>
			<input class="input" disabled="false" type="text" v-model="dptname">
		</view>
		<view class="boxtext">
			<text class="text">性别</text>
			<input class="input" disabled="false" type="text" v-model="list.sex">
		</view>
		<view class="boxtext">
			<text class="text">年龄</text>
			<input class="input" disabled="false" type="text" v-model="list.age">
		</view>
		<view class="boxtext">
			<text class="text">绑定手机</text>
			<input class="input" disabled="false" type="text" v-model="list.tel">
		</view>
		<view class="boxtext">
			<text class="text">联系地址</text>
			<input class="input" disabled="false" type="text" v-model="list.address">
		</view>
		<view class="logout">
			<button type="warn" @click="logout">退出登录</button>
		</view>
	</view>
</template>
		

<script>
	export default {
		data() {
			return {
				list:{},account:'',title:'个人信息',dptname:'',show:false
			}
		},
		onLoad(option) {
			this.account = option.account
			this.getdata();
		},
		methods: {
			async getdata(){
				const res =await this.Request({
					url:'api/employee/getempdataby',
					method:'POST',
					data:{account:this.account}
				})
				this.list = res.data[0]
				const dptname =await this.Request({
					url:'api/department/getdpt',
					method:'POST',
					data:{dptid:this.list.departmentid}
				})
				this.dptname = dptname.data[0].dptname
				uni.showToast({
					title:'正在加载',
					icon:"loading",
					duration:200
				})
				setTimeout(() => {
					this.show = true
				},200)
			},
			chang(){
				var item = JSON.stringify(this.list);
				uni.navigateTo({
					url:'/pages/public/homepage/perchang?item='+item
				})
			},
			logout(){
				this.Loginout();
			},
		}
	}
</script>

<style lang="scss">
	.logout{
		margin-top: 50upx;
		button{
			width:80%;
		}
	}
	.toptext{
		width: 100%;
		background-color: #efefef;
		display: flex;
		border-bottom: 1px solid #ccc;
		.text{
			margin: 5px 0 5px 5px;
			font-size: 110%;
			font-weight: 700;
			color: #d3d3d3;
		}
		.img1{
			margin: auto 0;
			height: 20px;
			width: 20px;
			margin-left: 260px;
		}
	}
	.boximg{
		height: 80px;
		width: 80px;
		display: flex;
		position: relative;
		.text{
			margin: auto 0;
			margin-left: 10px;
			font-size: 100%;
			font-weight: 600;
		}
		image{
			position: absolute;
			margin: 5px 0 5px 140px;
			height: 70px;
			width: 70px;
		}
	}
	.boxtext{
		height: 50px;
		display: flex;
		// position: relative;
		border-top: 1px solid #ccc;
		border-bottom: 1px solid #ccc;
		.text{
			margin: auto 0;
			margin-left: 10px;
			font-size: 100%;
			font-weight: 600;
		}
		.input{
			position: absolute;
			margin-top: 10px;
			margin-left: 135px;
			color: #eadbad;
		}
	}
</style>
